<?php
	include_once 'autoload.php';
	

	session_start();

	$ctl = new OrderalbumsCtl();
	$ctl->checkLogged();
	$ctl->checkNotReadonly();
	$ctl->proceed();
	
	$header = new Header();
	$header->render('Order Albums');
	
	// getting the form and proceed
	$form = $ctl->getOrderalbumsForm();
	$items = $form->getItems();

?>
<form method="post">
<input type="hidden" name="pagename" value="orderalbums" id="pgid">
<input type="hidden" name="metname" value="" id="metid">

<h2>Order Albums</h2>
<div class="padded">Select some albums and then 
click up or down - on <strong>ANY</strong>
line (they have the same effect, you don't have to click on that
particular line to be moved)</div>
<table cellpadding="4" cellspacing="0" class="list" id="list">
	<thead>
		<tr>
			<td>&nbsp;</td>
			<td nowrap="">Album Name</td>
			<td nowrap="">
			<div align="center">Move</div>
			</td>
		</tr>
	</thead>
	<tbody>
	<?php
	foreach ($items as $current){
		$id = $current->getId();
		$name = htmlspecialchars($current->getName());
	?>
		<tr>
			<td><input type="checkbox" value="<?php echo $id; ?>"></td>
			<td><?php  echo $name; ?></td>
			<td nowrap>
				<a href="javascript: moveline(1);">up</a>
				<a href="javascript: moveline(0);">down</a>
			</td>
		</tr>
	<?php 
	}
	?>
	</tbody>
</table>
</form>
<?php
	$footer = new Footer();
	$footer->render();
?>
